/*
 * @(#)EntityBase.java  
 *       
 * 系统名称＄1�7    OpenSeats信息系统
 * 版本号：      1.0
 *  
 * Copyright (c)  TravelSky.com
 * All rights reserved.
 * 
 * 作�1�7�1�7 	  yurb
 * 创建日期:    2008-10-5
 * 
 * 功能描述＄1�7
 * 公用方法描述＄1�7
 * 
 * 修改人：
 * 修改日期＄1�7
 * 修改原因＄1�7
 * 
 */

package com.bjypc.youth.entity;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.persistence.Version;

import com.googlecode.jsonplugin.annotations.JSON;

/**
 * 
 * <p>数据实体基类<br>
 * @author  yurb
 * @since 2008-10-5 下午02:12:31
 */
@MappedSuperclass
public abstract class EntityBase implements java.io.Serializable
{
	/**
	 * Comment for <code>serialVersionUID</code>
	 */
	private static final long serialVersionUID = 7847239770284826759L;
	public abstract Long getId();
	

	
	@Version
	@Column(name="VERSION",precision = 6, scale = 0)
	private Long version;
	
	@JSON(serialize=false,deserialize=false)
	public Long getVersion()
	{
		return version;
	}

	public void setVersion(Long version)
	{
		this.version = version;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((version == null) ? 0 : version.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final EntityBase other = (EntityBase) obj;
		if (version == null) {
			if (other.version != null)
				return false;
		} else if (!version.equals(other.version))
			return false;
		return true;
	}

}

